// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程：https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
const uniCaptcha = require('uni-captcha')
module.exports = {
	_before: function () {
		this.params = JSON.parse(this.getHttpInfo().body)
	},
	/**
	 * verify方法描述
	 * @param {string} scene 场景,captcha 验证码, deviceId 设备ID
	 * @returns {object} 返回值描述
	 */
	async verifyCaptchaCode() {
		let {scene,captcha,deviceId} = this.params
		if (!scene || !captcha || !deviceId) {
			return {
				errCode: 'PARAM_IS_NULL',
				errMsg: '参数不能为空'
			}
		}
		// 业务逻辑
		let res = await uniCaptcha.verify({deviceId,captcha,scene})
		return res
	}
}